package com.mouliu.base.syn13;

/**
 * @author mouliu
 * @create 2018-03-31-上午10:06
 */
public class Task implements Comparable<Task> {
    private int id;
    private String name;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    /**
     *如果ID>传入的id 则为1 ，相等则为0，不相等为-1
     * */
    @Override
    public int compareTo(Task o) {
        return this.id>o.id?1:(this.id<o.id?-1:0);
    }

    @Override
    public String toString() {
        return this.id+","+this.name;
    }
}
